package com.evildog.workspace.system.application.convert;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.evildog.workspace.common.result.PagedResult;
import com.evildog.workspace.dependencies.mybatis.object.LinkIdDTO;
import com.evildog.workspace.system.application.bo.UserGroupBO;
import com.evildog.workspace.system.application.bo.UserGroupListBO;
import com.evildog.workspace.system.application.bo.UserGroupPageBO;
import com.evildog.workspace.system.application.dto.UserGroupDTO;
import com.evildog.workspace.system.application.dto.UserGroupListDTO;
import com.evildog.workspace.system.application.dto.UserGroupPageDTO;
import com.evildog.workspace.system.application.entity.UserGroup;
import com.evildog.workspace.system.application.entity.UserGroupListDO;
import com.evildog.workspace.system.application.entity.UserGroupPageDO;
import com.evildog.workspace.system.application.model.UserGroupListParam;
import com.evildog.workspace.system.application.model.UserGroupPageParam;
import com.evildog.workspace.system.application.model.UserGroupParam;
import com.evildog.workspace.system.application.model.UserGroupUpdateRoleParam;
import com.evildog.workspace.system.application.vo.UserGroupListVO;
import com.evildog.workspace.system.application.vo.UserGroupPageVO;
import com.evildog.workspace.system.application.vo.UserGroupVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface UserGroupConvert {

    UserGroupConvert INSTANCE = Mappers.getMapper(UserGroupConvert.class);

    UserGroupPageDTO convert(UserGroupPageParam userGroupPageParam);

    UserGroupListDTO convert(UserGroupListParam userGroupListParam);

    UserGroupDTO convert(UserGroupParam userGroupParam);

    @Mapping(target = "isDeleted", ignore = true)
    UserGroup convert(UserGroupDTO userGroupDTO);

    UserGroupPageDO convert(UserGroupPageDTO userGroupPageDTO);

    UserGroupVO convert(UserGroupBO userGroupBO);

    UserGroupBO convert(UserGroup userGroup);

    List<UserGroupListBO> convert(List<UserGroupListDO> userGroupList);

    List<UserGroupListVO> convertVoList(List<UserGroupListBO> userGroupListBO);

    @Mappings({})
    PagedResult<UserGroupPageBO> convert(IPage<UserGroupPageDO> page);

    PagedResult<UserGroupPageVO> convert(PagedResult<UserGroupPageBO> page);

    @Mapping(target = "linkIds", source = "roleIds")
    LinkIdDTO convert(UserGroupUpdateRoleParam param);

    List<UserGroupListBO> convertBOList(List<UserGroup> userGroups);
}